package com.bruce.principle.openclose;

/**
 * Java课程打折实现类
 * Created by bruce on 2018/10/21 23:12
 */
public class JavaDiscountCourse extends JavaCourse {
    public JavaDiscountCourse(Integer id, String name, Double price) {
        super(id, name, price);
    }

    public Double getOriginPrice(){
        return super.getPrice();
    }

    //其实违反了里氏替换原则,请看JavaDiscountCourse
    @Override
    public Double getPrice() {
        //可以做业务逻辑处理,例如按照价格打折
        return super.getPrice() * 0.8;
    }
}
